/*
 * @Author: WangShuai 1830773767@qq.com
 * @Date: 2025-06-08 09:56:20
 * @LastEditors: WangShuai 1830773767@qq.com
 * @LastEditTime: 2025-06-08 20:05:53
 * @FilePath: \vue3_admin_template\project\src\api\product\sku\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A
 */
//SKU接口模块
import request from '@/utils/request'
import type { SkuResponseData, SkuInfoData } from './type'
enum API {
  //获取已有的SKU商品的数据
  SKU_URL = '/admin/product/list/',
  //SKU下架的接口
  SKUCANCEL_URL = '/admin/product/cancelSale/',
  //SKU上架接口
  SKUONSALE_URL = '/admin/product/onSale/',
  //获取商品详情接口
  SKUINFO_URL = '/admin/product/getSkuInfo/',
  //删除SKU商品接口
  REMOVESKU_URL = '/admin/product/deleteSku/',
}

//获取已有的SKU接口
export const reqSkuList = (pageNo: number, limit: number) =>
  request.get<any, SkuResponseData>(API.SKU_URL + `${pageNo}/${limit}`)
//商品上架方法
export const reqSkuOnSale = (skuId: number | string) =>
  request.get<any, any>(API.SKUONSALE_URL + `${skuId}`)
//商品下架方法
export const reqSkuCanelSale = (skuId: number | string) =>
  request.get<any, any>(API.SKUCANCEL_URL + `${skuId}`)
//获取商品详情接口
export const reqSkuInfo = (skuId: number | string) =>
  request.get<any, SkuInfoData>(API.SKUINFO_URL + `${skuId}`)
//删除商品接口
export const reqRemoveSku = (skuId: number | string) =>
  request.get<any, SkuInfoData>(API.REMOVESKU_URL + `${skuId}`)
